package top.wxdfun.sqlwr.config;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class DBContextHolder {

    private static final ThreadLocal<String> local = new ThreadLocal<>();

    public static ThreadLocal<String> getLocal() {
        return local;
    }

    /**
     * 读
     */
    public static void read() {
        log.debug("read");
        getLocal().set(DBTypeEnum.read.getType());
    }

    /**
     * 写
     */
    public static void write() {
        log.debug("write");
        getLocal().set(DBTypeEnum.write.getType());
    }

    public static String getDBType() {
        return getLocal().get();
    }
}
